close all;
clear all;

inputvideo = 'video.avi';

nr = 256;       %input image size - num of rows
nc = 256;       %input image size - num of cols
Nc= 1;          % number of center channels
q = quantizer('fixed', [32,20]);    %input data representation (32 bits, 20 fraction bits)

mov = aviread(inputvideo);
aviobj = avifile('MovieSaliency2.avi');
aviobj.Quality=100;
%aviobj.height=256;
%aviobj.width=256;
aviobj.Compression='none';
input_im_prev=zeros(size(mov(1,1).cdata));


for i=1:50
%i    
input_im_curr = mov(1,i).cdata; 
if(i>1)
input_im_prev = mov(1,i-1).cdata; 
end

% if (i>1)
%     pyrprev = pyrcurr;
%     [Sal, iSal, cSal, oSal,mSal, im2, pyrcurr] = saliency_hw_sim(input_im, nr, nc, Nc,i, pyrprev);
% else
%     [Sal, iSal, cSal, oSal,mSal, im2, pyrcurr] = saliency_hw_sim(input_im, nr, nc, Nc, i);
% end

 [Sal, iSal, cSal, oSal,mSal, im2] = saliency_hw_sim(input_im_prev,input_im_curr, nr, nc, Nc, i);
%%M= im2frame(imresize(Sal,[nr,nc], 'bicubic'));
subplot(1,2,1); imagesc(imresize(input_im_curr, [nr,nc])); %equal axis; 
subplot(1,2,2); imagesc(imresize(Sal,[nr,nc])); %equal axis; 
%mSal
F(i)= getframe;
aviobj = addframe(aviobj,F);
end
 aviobj = close(aviobj);
%%movie(F,1);


    
  